
namespace Serenity.Abstractions;

/// <summary>
/// Interface for permission services that supports granting permissions temporarily
/// </summary>
public interface ITransientGrantor
{
    /// <summary>
    /// Grants specified permissions temporarily (or makes it look like)
    /// </summary>
    /// <param name="permissions">List of permission keys</param>
    void Grant(params string[] permissions);

    /// <summary>
    /// Grants all permissions temporarily (or makes it look like)
    /// </summary>
    void GrantAll();

    /// <summary>
    /// Undoes last grant or grant all operation
    /// </summary>
    void UndoGrant();

    /// <summary>
    /// Returns true if currently all permissions are granted via GrantAll.
    /// </summary>
    bool IsAllGranted();

    /// <summary>
    /// Returns a list of permissions granted via Grant.
    /// </summary>
    IEnumerable<string> GetGranted();
}